package com.wqy.netty.client;

import java.io.IOException;
import java.net.Socket;
import java.nio.ByteBuffer;

/**
 * @Auther: WangQingyang
 * @Date: 2020/4/1 14:52
 * @Description:
 */
public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket =new Socket("127.0.0.1",10010);
        String msg = "hello";
        ByteBuffer byteBuffer = ByteBuffer.allocate(4+msg.length());
        //长度
        byteBuffer.putInt(msg.length());
        //内容
        byteBuffer.put(msg.getBytes());
        for (int i=0;i<1000;i++){
            socket.getOutputStream().write(byteBuffer.array());

        }
        socket.close();
    }
}
